import { request } from '@/utils/request'

/**
 * 获取城市
 */
export const getCityApi = ({ lat, lng }) =>
  request({
    method: 'get',
    url: '/portal/homepage/city_desc/get/nologin',
    data: {
      lat,
      lng
    }
  })

/**
 * 获取城市下拉筛选数据列表
 */
export const getFilterPullListApi = ({ cityId, dirtTypes }) => {
  return request({
    method: 'post',
    url: '/portal/homepage/pull_list/get/nologin',
    data: {
      cityId,
      dirtTypes
    }
  })
}
/**
 * 根据条件获取房源列表
 */
export const getHouseListApi = ({
  cityId,
  regionId,
  rentalRanges,
  rentTypes,
  rooms,
  sort,
  pageNo,
  pageSize,
  longitude,
  latitude
}) => {
  return request({
    method: 'post',
    url: '/portal/homepage/house_list/search/nologin',
    data: {
      cityId,
      regionId,
      rentalRanges,
      rentTypes,
      rooms,
      sort,
      pageNo,
      pageSize,
      longitude,
      latitude
    }
  })
}

/**
 * 获取房源详情
 */
export const getHouseDetailApi = (houseId) => {
  return request({
    method: 'get',
    url: '/portal/housepage/get/nologin',
    data: {
      houseId
    }
  })
}

/**
 * 获取 [热门和全] 城市列表
 */
export const getCityListApi = () => {
  return request({
    method: 'get',
    url: '/portal/citypage/get/nologin'
  })
}
